#include "syscall.h"

int Lock[4];
void client1_main()
{
	WriteFormat("----------Test Case II----------\n",34,0,0);
	WriteFormat("2-1 Distributed Lock Function in Multi Client \n",48,0,0);
	WriteFormat("    Create New Lock \n",22,0,0);
	Lock[0] = RemoteCreateLock("MultiClientTestLock1",20);
	WriteFormat("    Try to Acquire New Lock %d \n",33,Lock,1);
	WaitInput();
	RemoteAcquireLock(Lock[0]);
	WriteFormat("    Wait another client to Acquire this Lock \n",47,0,0);
	WaitInput();
	WriteFormat("    Try to Release Lock %d \n",29,Lock,1);
	RemoteReleaseLock(Lock[0]);
	WriteFormat("    Try to Reacquire this Lock \n",33,0,0);
	WaitInput();
	RemoteAcquireLock(Lock[0]);
	WriteFormat("    Re-Acquired Lock %d \n",26,Lock,1);
	RemoteReleaseLock(Lock[0]);
	RemoteDestroyLock(Lock[0]);
	WriteFormat("------------test end-----------\n",33,0,0);
	return;
	
	
}
int main()
{
	client1_main();
}
